import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool flag = true;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        floatingActionButton: FloatingActionButton(
          child: const Icon(Icons.add),
          onPressed: () {
            setState(() {
              flag = !flag;
            });
          },
        ),
        appBar: AppBar(
          title: const Text('AnimatedContainer'),
        ),
        body: AnimatedPadding(
            padding: EdgeInsets.fromLTRB(flag ? 10 : 100, flag ? 10 : 100, 0, 0),
            duration: const Duration(milliseconds: 500),
        curve: Curves.bounceInOut,
        child: Container(
          width: 100,
          height: 100,
          color: Colors.red,
        ),
      ),
    ),);
  }
}
